﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Media.Animation;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Sara
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();
            this.SourceInitialized += new EventHandler(Window1_SourceInitialized);
        }

        void Window1_SourceInitialized(object sender, EventArgs e)
        {
            GlassHelper.ExtendGlassFrame(this, new Thickness(-1));
            DeactivateIndicator();
        }

        public void ActivateIndicator()
        {
            Storyboard sbAct = (Storyboard)FindResource("FadeWindowIn");
            sbAct.Completed += new EventHandler(sbActivate_Completed);
            sbAct.Begin();
            ActiveIndicatorLabel.Content = "Listening";
        }

        public void DeactivateIndicator()
        {
            Storyboard sbDeact = (Storyboard)FindResource("DeactivateIndicatorSb");
            sbDeact.Completed += new EventHandler(sbDeactivate_Completed);
            sbDeact.Begin();
            ActiveIndicatorLabel.Content = "Sleeping";
            textBlock1.Text = "";
            
        }

        void sbDeactivate_Completed(object sender, EventArgs e)
        {
            Storyboard sb = (Storyboard)FindResource("FadeWindowOut");
            sb.Begin();
        }

        void sbActivate_Completed(object sender, EventArgs e)
        {
            Storyboard sb = (Storyboard)FindResource("ActivateIndicatorSb");
            sb.Begin();
        }
    }
}
